//
//  WSOrderPageViewController.m
//  FD
//
//  Created by Yasin on 2018/10/22.
//  Copyright © 2018年 ZhiYuan Network. All rights reserved.
//  外送分页效果

#import "WSOrderPageViewController.h"
#import "YNPageViewController.h" //分页效果
#import "WSOrderAllViewController.h" //全部
#import "WSOrderPayViewController.h" //代付款
#import "WSOrderEvaluateViewController.h" //待评价
#import "WSOrderTuiKuanViewController.h" //退款、售后
@interface WSOrderPageViewController ()
<YNPageViewControllerDelegate,
YNPageViewControllerDataSource>

@end

@implementation WSOrderPageViewController

- (void)viewDidLoad {
    [super viewDidLoad];
}

+ (instancetype)wsorderTopPageVC {
    YNPageConfigration *configration = [YNPageConfigration defaultConfig];
    configration.pageStyle = YNPageStyleTop;
    configration.headerViewCouldScale = YES;
    configration.headerViewScaleMode = YNPageHeaderViewScaleModeTop;
    configration.showTabbar = NO;
    configration.showNavigation = YES;
    configration.scrollMenu = NO;
    configration.aligmentModeCenter = NO;
    configration.lineWidthEqualFontWidth = YES;
    //    configration.showBottomLine = YES;
    configration.lineColor = [UIColor redColor]; //线的颜色
    configration.selectedItemColor = [UIColor blackColor];
    
    WSOrderPageViewController *vc = [WSOrderPageViewController pageViewControllerWithControllers:[self getArrayVCs] titles:[self getArrayTitles] config:configration];

    
    vc.dataSource = vc;
    vc.delegate = vc;
    
    return vc;
}

+ (NSArray *)getArrayVCs {
    
    WSOrderAllViewController * vc1 = [[WSOrderAllViewController alloc] init];
    WSOrderPayViewController *vc2 = [[WSOrderPayViewController alloc] init];
    vc2.view.backgroundColor = [UIColor yellowColor];
    WSOrderEvaluateViewController *vc3 = [[WSOrderEvaluateViewController alloc] init];
    vc3.view.backgroundColor = [UIColor blueColor];
    WSOrderTuiKuanViewController *vc4 = [[WSOrderTuiKuanViewController alloc] init];
    vc4.view.backgroundColor = [UIColor blackColor];
    return @[vc1, vc2, vc3,vc4];
}

+ (NSArray *)getArrayTitles {
    //国际化
    NSString *allStr = NSLocalizedString(Order_Whole, @"全部");
    NSString *waitPay = NSLocalizedString(Order_Pending, @"待付款");
    NSString *waitEvaluate = NSLocalizedString(Order_Evaluate, @"待评价");
    NSString *afterSale = NSLocalizedString(Order_AfterSale, @"退款/售后");

    return @[allStr, waitPay,waitEvaluate, afterSale];
}

#pragma mark - YNPageViewControllerDataSource
- (UIScrollView *)pageViewController:(YNPageViewController *)pageViewController pageForIndex:(NSInteger)index {
    
    WSOrderAllViewController *vc = pageViewController.controllersM[index];
    vc.view.backgroundColor = [UIColor redColor];
    return [vc tableView];
}
@end
